package com.sang.service.impl;

import com.sang.VO.UserVO;
import com.sang.feign.OrderFeign;
import com.sang.mapper.UserMapper;
import com.sang.pojo.User;
import com.sang.service.Userservice;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements Userservice {

    @Autowired
    OrderFeign orderFeign;

    @Autowired
    UserMapper userMapper;
    public UserVO findById(String username){
        User user = userMapper.findById(username);
        UserVO userVO=new UserVO();
        BeanUtils.copyProperties(user,userVO);
        userVO.setOrderList(orderFeign.findOrderByUserName(username));
        return userVO;
    }
}
